﻿<Page
    x:Class="Renren.Components.ImageToolsTester.Win8.Filter"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Renren.Components.ImageToolsTester.Win8"
    xmlns:it="using:ImageTools.Controls"
    xmlns:itFilter="using:ImageTools.Filtering"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    d:DataContext="local:MainPageViewModel"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Page.Resources>
        <it:ImageConverter x:Key="ImageConverter"/>
    </Page.Resources>
    
    <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition />
            <ColumnDefinition />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>

        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="5*"/>
            <RowDefinition Height="6*" />
        </Grid.RowDefinitions>
        <Border Margin="5" Grid.Row="1" Grid.Column="0">
            <StackPanel>
                <it:ImageExt Source="{Binding ImageSource, Converter={StaticResource ImageConverter}}" />
                <TextBlock Text="Original image without a filter." />
            </StackPanel>
        </Border>

        <Border Margin="5" Grid.Row="1" Grid.Column="1">
            <StackPanel>
                <it:ImageExt Source="{Binding ImageSource, Converter={StaticResource ImageConverter}}">
                <it:ImageExt.Filter>
                        <itFilter:Sepia/>
                </it:ImageExt.Filter>
                </it:ImageExt>
                <TextBlock Text="Sepia filter." />
            </StackPanel>
        </Border>
        
        <Border Margin="5" Grid.Row="1" Grid.Column="2">
            <StackPanel>
                <it:ImageExt Source="{Binding ImageSource, Converter={StaticResource ImageConverter}}">
                    <it:ImageExt.Filter>
                        <itFilter:GrayscaleBT709 />
                    </it:ImageExt.Filter>
                </it:ImageExt>
                <TextBlock Text="Grayscale filter." />
            </StackPanel>
        </Border>
        
        <Border Margin="5" Grid.Row="1" Grid.Column="3">
            <StackPanel>
                <it:ImageExt Source="{Binding ImageSource, Converter={StaticResource ImageConverter}}">
                    <it:ImageExt.Filter>
                        <itFilter:GaussianBlur Variance="0" />
                    </it:ImageExt.Filter>
                </it:ImageExt>
                <TextBlock Text="Gaussian blur filter using a variance of 2." />
            </StackPanel>
        </Border>

        <Border Margin="5" Grid.Row="2" Grid.Column="0">
            <StackPanel>
                <it:ImageExt Source="{Binding ImageSource, Converter={StaticResource ImageConverter}}">
                    <it:ImageExt.Filter>
                        <itFilter:Inverter />
                    </it:ImageExt.Filter>
                </it:ImageExt>
                <TextBlock Text="Invert filter" />
            </StackPanel>
        </Border>

        <Border Margin="5" Grid.Row="2" Grid.Column="1">
            <StackPanel>
                <it:ImageExt Source="{Binding ImageSource, Converter={StaticResource ImageConverter}}">
                    <it:ImageExt.Filter>
                        <itFilter:SobelX />
                    </it:ImageExt.Filter>
                </it:ImageExt>
                <TextBlock Text="SobelX Filter." />
            </StackPanel>
        </Border>

        <Border Margin="5" Grid.Row="2" Grid.Column="2">
            <StackPanel>
                <it:ImageExt Source="{Binding ImageSource, Converter={StaticResource ImageConverter}}">
                    <it:ImageExt.Filter>
                        <itFilter:SobelY />
                    </it:ImageExt.Filter>
                </it:ImageExt>
                <TextBlock Text="SobelY Filter." />
            </StackPanel>
        </Border>

        <Border Margin="5" Grid.Row="2" Grid.Column="3">
            <StackPanel>
                <it:ImageExt Source="{Binding ImageSource, Converter={StaticResource ImageConverter}}">
                    <it:ImageExt.Filter>
                        <itFilter:PrewittX/>
                    </it:ImageExt.Filter>
                </it:ImageExt>
                <TextBlock Text="PrewittX Filter."/>
            </StackPanel>
        </Border>
        
        <Button Content="Go Back" HorizontalAlignment="Left" Margin="32,10,0,0" VerticalAlignment="Top" Height="48" Width="122" Click="Button_Click_1"/>

    </Grid>
</Page>